import CryptoJS from 'crypto-js'

const secretKey = "R89kMXt63eoPDOYKzfqFly5psJCETnNQjWBwUa0b"

/**
 * Aes加密
 * @param message 
 * @returns 
 */
export const aesStr = (message: string) => {
    return CryptoJS.AES.encrypt(message, secretKey);
}

/**
 * Aes解密
 * @param ciphertext 
 * @returns 
 */
export const unAesStr = (ciphertext: string) => {
    var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), secretKey);
    var originalText = bytes.toString(CryptoJS.enc.Utf8);
    return originalText;
}